package com.colt.contentcenter.feighclient;

import com.colt.contentcenter.domain.dto.messaging.UserUpdateBonusMsgDTO;
import com.colt.contentcenter.domain.dto.user.UserDTO;
import com.colt.contentcenter.feighclient.fallback.factory.UserFeignClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @program: content-center
 * @description: 通过Feigh远程调用user-center微服务接口
 * @author: colt
 * @create: 2020-05-08 10:32
 **/
//@FeignClient(name = "user-center",configuration = UserCenterFeighConfiguration.class)
@FeignClient(name = "user-center"
      //  fallback = UserCenterFeignClientFallback.class, // fallback 和fallbackfactoory不要同时使用
        ,fallbackFactory = UserFeignClientFallbackFactory.class
)
public interface UserCenteFeighrClient {
    /**
    * @Description:  http://user-cent/users/{id}
    * @Param:  id
    * @return:  UserDto
    * @Author: colt
    * @Date: 2020/5/8
    */
    //feign在调用的时候会传输这个header里的token
    @GetMapping("/users/{id}")
    public UserDTO findById(@PathVariable Integer id
 //           , @RequestHeader("X-Token") String token
    );

    @GetMapping("/users/query")
    UserDTO query(UserDTO userDTO);

    @PutMapping("/users/add-bonus")
    UserDTO addBonus(@RequestBody UserUpdateBonusMsgDTO dto);

}
